home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR10 / SPX20.ZIP / SPX_DOC.ZIP / SPX_IMG.DOC < prev    next >
Text File  |  1993-09-15  |  5KB  |  129 lines

  1. { SPX Library Version 2.0  Copyright 1993 Scott D. Ramsay }
  2.  
  3.   SPX_IMG is the image handling unit.  It allows loading and saving
  4. of picture files.  It supports loading of 320x200x256 PCX files, BMP and
  5. my own custom compressed format.  PTR files are a quick and dirty RLE
  6. picture format. It does not save the palette data in the file so use
  7. the loadcolors/savecolors procedures to use it's palette.
  8.  
  9. ───────────────────────────────────────────────────────────────────────────
  10. type
  11.   VidHdrType = record
  12.                  position,count : word;
  13.                end;
  14.  
  15.   Header type for .PTR format
  16.  
  17. ───────────────────────────────────────────────────────────────────────────
  18. Error Constants:
  19.  
  20.   img_noerror   = 0;    { no error }
  21.   img_notbmp    = 1;    { not a win3.0 BMP file }
  22.   img_notpcx    = 2;    { not a 256 color PCX file }
  23.   img_errorload = 3;    { file not found or open error }
  24.   img_errorread = 4;    { other disk read error }
  25.   img_badcolor  = 5;    { not 8bit BMP file }
  26.   img_errorsave = 6;    { error saving PTR file }
  27.   img_erralloc  = 7;    { memory allocation error }
  28.  
  29. ───────────────────────────────────────────────────────────────────────────
  30. var
  31.   rgb256         : RGBlist;     { palette of last loaded PCX,BMP file }
  32.  
  33. ───────────────────────────────────────────────────────────────────────────
  34. function loadbmp(bfilename:string;x,y:integer):integer;
  35.  
  36.   (x,y)   Area to place the top-left corner of the image
  37.  
  38.   Loads only a 256 color BMP file to the active page.  The palette of
  39.   the loaded BMP file will be copied to the variable RGB256.  If the image
  40.   is larger than 320x200 then it will be clipped.
  41.  
  42.   Returns an error constant value
  43.  
  44.  
  45. ───────────────────────────────────────────────────────────────────────────
  46. function loadpcx(pfilename:string):integer;
  47.  
  48.   Loads a 320x200x256 color PCX file to the active page.  The palette of
  49.   the loaded pcx file will be copied to the variable RGB256.
  50.  
  51.   Returns an error constant value
  52.  
  53.   PFILENAME:  DOS file name of the pcx file to load
  54.  
  55.   NOTE: This function is very fast.  However as a cost it will only
  56.     load 320x200x256 pcx files.  Use loadspcx to load pcx files that
  57.     are smaller than 320x200.
  58.  
  59. ───────────────────────────────────────────────────────────────────────────
  60. function loadspcx(fname:string;x,y:integer):boolean;
  61.  
  62.   Loads a 256 PCX file to the active page.  The palette of the loaded
  63.   pcx file will be copied to the variable RGB256.
  64.  
  65.   Returns an error constant value
  66.  
  67.   FNAME:  DOS file name of the pcx file to load
  68.   X,Y:    Row,Column position to place the top-left of the pcx file
  69.  
  70.   NOTE: This function is slower than the loadpcx function.  It can load
  71.     256 color pcx files of any resolution.  Large pcx files will be clipped.
  72.  
  73. ───────────────────────────────────────────────────────────────────────────
  74. procedure filepcx(var pcxfile:file;size:longint);
  75.  
  76.   Loads a PCX file from an open file to the active page.  The palette
  77.   of the loaded pcx file will be copied to the variable RGB256.
  78.  
  79.   PCXFILE:  File to read the pcx data;
  80.   SIZE:     Size of the PCX data in the file
  81.  
  82. ───────────────────────────────────────────────────────────────────────────
  83. procedure drawpcx(var p;size:word);
  84.  
  85.    Displays a 320x200x256 PCX file currently in memory.
  86.  
  87.    P:     Buffer where the pcx data is located;
  88.    SIZE:  Size of the PCX data in memory
  89.  
  90. ───────────────────────────────────────────────────────────────────────────
  91. procedure drawspcx(var start;size:longint;x,y:integer);
  92.  
  93.    Displays a 256 color PCX file currently in memory.
  94.  
  95.    START: Buffer where the pcx data is located;
  96.    SIZE:  Size of the PCX data in memory
  97.    X,Y:   Row,Column position to place the top-left of the pcx file
  98.  
  99.    This function will load any size pcx file.  Large files will be clipped.
  100.  
  101. ───────────────────────────────────────────────────────────────────────────
  102. function LoadPTR(fn:string;merge:boolean):integer;
  103.  
  104.    Loads a .PTR file to the active page.
  105.  
  106.    FN:     DOS file name of the ptr file to load;
  107.    MERGE:  Set to TRUE to overlay the PTR file over the
  108.            active page
  109.  
  110.    Returns an error constant value
  111.  
  112. ───────────────────────────────────────────────────────────────────────────
  113. procedure DrawPtr(var p;merge:boolean;sz:longint);
  114.  
  115.   Displays a PTR file currently in memory.
  116.  
  117.   P:     Buffer where the ptr data is located;
  118.   MERGE: Set to TRUE to overlay the PTR file over the
  119.          active page
  120.  
  121. ───────────────────────────────────────────────────────────────────────────
  122. function SavePTR(fn:string):integer;
  123.  
  124.   Save the active page as a PTR file.
  125.  
  126.   FN: DOS file name of the ptr file to save
  127.  
  128. ───────────────────────────────────────────────────────────────────────────
  129.